import Vue from 'vue'
import Vuex from 'vuex'
import statistics from './modules/statistics'
import ChildrenReport from './modules/ChildrenReport'
import createPersistedState from 'vuex-persistedstate'
Vue.use(Vuex)

const store = new Vuex.Store({
  state: {
    treedataobj: {},
    monitordataobj: {},
    node: {}
  },
  // 定义mutations
  mutations: {
    // 事件类型+回调函数
    // 事件类型() {}
    settreedata (state, data) {
      state.treedataobj = data
    },
    setmonitordata (state, data) {
      state.monitordataobj = data
    },
    setnode (state, data) {
      state.node = data
    }
  },
  modules: {
    statistics,
    ChildrenReport
  },
  plugins: [createPersistedState({
    paths: ['ChildrenReport.AttachmentList','ChildrenReport.taskId']
  })]
})
export default store